#ifndef GRASS_HPP_
#define GRASS_HPP_

//#include <aerMesh.hpp>
#include <device/aerProgram.hpp>
#include <device/aerTexture.hpp>
#include <device/aerVertexArray.hpp>
#include <device/aerDeviceBuffer.hpp>
#include <misc/aerHeightmap.hpp>
#include <view/aerCamera.hpp>//


#define TERRAIN_MAX_HEIGHT 30.0f

class Grass
{
  public:
    static const float kTerrainMaxHeight =  TERRAIN_MAX_HEIGHT;//
    static const float kLowerThreshold   =  0.3f*TERRAIN_MAX_HEIGHT;//
    static const float kUpperThreshold   =  0.45f*TERRAIN_MAX_HEIGHT;//
    
  private:
    aer::Program m_program;
    aer::Texture m_texture;
    //aer::Mesh    m_mesh;
    
    aer::VertexArray   m_vao;
    aer::DeviceBuffer m_vbo;
    
    aer::U32 m_grassCount;
    
    
  public:
    Grass();
    ~Grass();
    
    bool init(const aer::Heightmap &heightmap);
        
    void render(const aer::Camera &camera);
    
  
  private:
    void initShader();
    void initTexture();
    void initGeometry(const aer::Heightmap &heightmap);
};

#endif //GRASS_HPP__
